/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){
    $( "#modal" ).dialog({
        autoOpen: false            

    });
        
    $('body').delegate('a', 'click', function(e){
        container=$(e.currentTarget).attr('target-container');
        $(container).html('<img class="loader" src="/bundles/specialoperationsgame/images/ajax-loader.gif" alt="Loading..." />');
        $.ajax({
                url: $(e.currentTarget).attr('data-url'),
    //            dataType: 'json',            
                success: function(data){
                    if(container=="dialog"){
                        $("#modal").html(data);
                        $("#modal").dialog( "option", "title", $(e.currentTarget).attr('title') );
                        $( "#modal" ).dialog( "open" );
                        
                    }
                    else{
                        $(container).html(data);
                    }
                    $( "input:submit, a, button", ".panel" ).button();
                }
            });
        })
        $( "input:submit, a, button", ".panel" ).button();
        



});
